/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.component.gateway.dianlan.processor;

import info.peigen.hotpot.component.gateway.dianlan.facade.command.DianlanServiceFacade;
import info.peigen.hotpot.component.gateway.dianlan.protocol.Dianlan;
import info.peigen.hotpot.component.gateway.dianlan.util.DianlanUtil;
import lombok.AccessLevel;
import lombok.experimental.FieldDefaults;
import lombok.extern.slf4j.Slf4j;
import org.noear.solon.annotation.Inject;
import org.smartboot.socket.transport.AioSession;


/**
 * <b>(AbstractDianlanProcessor)</b>
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2022/8/26
 */
@SuppressWarnings("ALL")
@FieldDefaults(level = AccessLevel.PROTECTED)
@Slf4j
public abstract class AbstractDianlanProcessor {
    @Inject
    DianlanServiceFacade dianlanServiceFacade;

    protected static final String IGNORE_PORT = "02";

    protected void write(AioSession session, Dianlan dianlan) {
        DianlanUtil.write(session, dianlan);
    }

    protected void response(Dianlan dianlan, Object obj) {
        DianlanUtil.response(dianlan, obj);
    }

    protected void ignorePort(Dianlan dianlan) {
        log.info("屏蔽02号枪命令：" + dianlan.getFrameSign().getMessage());
    }
}